home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
uw_1.exe
/
UW.H
< prev
next >
Wrap
Text File
|
1992-11-03
|
17KB
|
441 lines
/****************************************************************************/
/* */
/* UW.H */
/* */
/* This is the main header for uWin, containing all the defines and */
/* typedefs for the program. */
/* Kevin Huck */
/* Boyd Gafford */
/* */
/****************************************************************************/
#ifndef __UW_H
#define __UW_H
#include <dos.h> /* for the REGS definition used for mouse int */
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>
#ifndef __ZTC__
#ifdef M_I86 /* Microsofts are malloc.h and memory.h */
#include <malloc.h>
#include <memory.h>
#include <sys\types.h>
#pragma pack(1)
#else /* Borlands are alloc.h and mem.h */
#include <alloc.h>
#include <mem.h>
#endif
#endif
#ifdef M_I86
#include <stddef.h>
#define setmem(p,c,v) memset((p),(v),(c))
#define movmem(s,d,c) memmove((d),(s),(c))
#define random(x) (rand() % (x))
#define bioskey(c) _bios_keybrd(c)
#define biosprint(s, d, p) _bios_printer(s, p, d)
#define getvect(i) _dos_getvect(i)
#define setvect(i,hdlr) _dos_setvect(i,hdlr)
#define enable _enable
#define disable _disable
#define setcolor _setcolor
#define moveto _moveto
#define lineto _lineto
#define outbyte outp
#define inbyte inp
#define outword outpw
#define inword inpw
struct REGPACK {
unsigned r_ax, r_bx, r_cx, r_dx;
unsigned r_bp, r_si, r_di, r_ds, r_es, r_flags;
};
enum COLORS {
BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN,
LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN,
LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
};
#define C80 3
#define BW80 2
#define MONO 7
#else
#define outbyte outportb
#define inbyte inportb
#define outword outport
#define inword inport
#endif
#ifdef __POWERC
#define C80 3
#define BW80 2
#define MONO 7
enum COLORS {
BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN,
LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN,
LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
};
#endif
#ifdef __ZTC__
#include <int.h>
#define interrupt
#define O_TRUNC 0
#define O_BINARY 0
#define enable int_on
#define disable int_off
#endif
/*-------------------------------- debug defines ---------------------------*/
#ifdef ENQ_DEBUG
#define DBG_POP() dbg_pop()
#define ENQ_ERROR( p1, p2, s1, s2, p ) enq_error( p1, p2, s1, s2, p )
#define WNP_VLD( s, m, wnp ) wnp_vld( s, m, wnp )
#define PRTP_VLD( s, m, prtp ) prtp_vld( s, m, prtp )
#define P_VLD( s, gp ) p_vld( s, gp )
#define MENUP_VLD( s, m, menup ) menup_vld( s, m, menup )
#define DBG_LOG( fname ) dbg__log( fname )
#else
#define DBG_POP()
#define ENQ_ERROR( p1, p2, s1, s2, p )
#define WNP_VLD( s, m, wnp )
#define PRTP_VLD( s, m, prtp )
#define P_VLD( s, gp )
#define MENUP_VLD( s, m, menup )
#define DBG_LOG( fname )
#endif
/*------------------------ rectangle operation defines ---------------------*/
#define NO_OVERLAP 0
#define OVERLAP 1
#define FIRST_ENCLOSED 2
#define SECOND_ENCLOSED 3
/*---------------------------- general defines -----------------------------*/
#define ON 1
#define OFF 0
#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3
/*------------------------------ menuing defines ---------------------------*/
#define M_HORIZONTAL 0
#define M_VERTICAL 1
#define M_MAX_ENTRIES 20
#define M_GET_EVENT 0
#define M_PROC_EVENT 1
#define M_EXIT_ON_ESC 1
/*---------------------------- mouse defines -------------------------------*/
#define TDELAY (clock_t) 4 /* clock ticks to check for multiple clicks */
#define LB 0 /* m_event->flag is 4 for left button */
#define MB 2 /* m_event->flag is 64 for middle button */
#define RB 1 /* m_event->flag is 16 for right button */
/*---------------------------- window defines ------------------------------*/
#define NO_BDR 0
#define SGL_BDR 1
#define DBL_BDR 2
#define SLD_BDR 3
#define DUAL_BDR 4
#define CENTERED -1
#define LEFT_JUST -2
#define RIGHT_JUST -3
#define ALPHA 'A'
#define DIGITS 'D'
#define C_LINE 0
#define C_SBLOCK 1
#define C_FBLOCK 2
#define IN 0
#define OUT 1
#define BUFF 0
#define SAVE 1
#define WN_POPUP 1
#define WN_NORMAL 0
#define DELETE 1
#define INSERT 0
#define STRIP_ON 1
#define STRIP_OFF 0
/*----------------------- printer support defines --------------------------*/
#define PRT_BLOCK 2048
#define MAX_PRINTERS 4
#define BLOCK_SIZE 512
#define READ 0
#define WRITE 1
/*------------------------- flags for wn_gets_ll ---------------------------*/
#define G_STRIP 0x0001
#define G_STRIP_END 0x0002
#define G_UP_FST_CHAR 0x0004
#define G_ARROW 0x0008
#define G_VALIDATE 0x0010
#define G_RIGHT_TO_LEFT 0x0020
#define G_EXIT_ON_FILL 0x0040
#define G_CLEAR_ON_FIRST 0x0080
#define G_UP_FST_CHAR2 0x0100
#define G_MOVE_TO_END 0x0200
#define G_INSERT 0x0400
#define H_ENTRY 0
#define H_PROCESS 1
#define H_EXIT 2
/*-------------------------- base level typedefs ---------------------------*/
typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
/*---------------------------- mouse structures ----------------------------*/
typedef struct reset_struct
{
int exists;
int n_buttons;
} M_RESET;
typedef struct loc_struct
{
int button_status;
int count;
int col;
int row;
} M_LOC;
typedef struct move_struct
{
int h_count;
int v_count;
} M_MOVE;
typedef struct event_struct
{
int is_mouse;
int key;
int mod;
int m_x, m_y;
int m_count, m_button;
} EVENT;
/*---------------------------- rectangle structure -------------------------*/
typedef struct rect_struct
{
int x_min, x_max, y_min, y_max; /* rectangle coordinates */
} RECT;
/*--------------------------- window structure -----------------------------*/
typedef struct w_struct
{
struct w_struct *next; /* next window in linked list */
struct w_struct *previous; /* previous window in list */
RECT pane; /* the window rectangle */
RECT old_pane; /* for full size toggle */
int rows; /* save buffer rows and columns */
int cols;
int csr_x; /* the "soft" cursor location */
int csr_y;
uchar att; /* the window's attribute */
uchar bdr_att; /* the window's border attribute */
int bdr_style; /* the border style */
int name_loc; /* CENTERED, LEFTJUST, RIGHTJUST */
char *name; /* pointer to window name */
uchar *save; /* pointer to save buffer area */
uchar *buff; /* pointer to write buffer area */
uchar *mask; /* pointer to window buffer mask */
uchar *tabs; /* tab stops */
int reg_s, reg_e; /* scroll region start and end */
unsigned hidden : 1; /* 1 if window hidden */
unsigned overlapped : 1; /* 1 if window overlapped */
unsigned csr_adv : 1; /* 1 if cursor auto advanced */
unsigned inside : 1; /* 1 if bordered and inside */
unsigned mask_on : 1; /* 1 if window mask is active */
unsigned popup : 1; /* 1 if window is popup */
unsigned scroll : 1; /* 1 if window auto-